<!-- 设备缺陷记录 entity.jsp -->
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/jsp/common/common.jsp"%>
<% //String bdzname = (String) request.getParameter("bdzname");
String ymbz=(String)request.getParameter("ymbz");
if(ymbz==null){
	ymbz="";
}
%>
<html>
	<head>
		<script type="text/javascript" src="<%=contextPath%>/js/jquery-1.3.2.min.js"></script> 
		<script type="text/javascript" src="<%=contextPath%>/js/validator.js"></script> 
		<script type="text/javascript" src="<%=contextPath%>/js/My97DatePicker/WdatePicker.js"></script>
		<script type="text/javascript" language="javascript">
		var isAdmin = '<c:out value="${isAdmin}"/>';  
			Ext.onReady(function(){
				var tb = new Ext.Toolbar({
			   		renderTo: document.all.tbar,
			    	items: [
				        {
				            text: '保存',
				            icon:"<%=contextPath%>/images/save.gif",
				            handler:toCheck,
				            hidden:<%=session.getAttribute("btn_save_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>
				        },'-',
				        {
				            text: '送消缺计划',
				            icon:"<%=contextPath%>/images/save.gif",
				            handler:pass,
				            hidden:<%=session.getAttribute("btn_passno_display") != null ? false:true%>
				        },'-',
				        {
				            text: '${searchBean.con1}' == '0'? '送消缺计划':'送已消除',
				            icon:"<%=contextPath%>/images/save.gif",
				            handler:pass,
				            hidden:<%=session.getAttribute("btn_history_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>
				        },'-',
						{
				            text: '生成工作任务单',
				            icon:"<%=contextPath%>/images/save.gif",
				            handler:passrwd,
				            hidden:<%=session.getAttribute("btn_history_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>,
							disabled:'${searchBean.con1}' == '0'? false:true
				        },'-',
				        {
				            text: '驳回',
				            icon:"<%=contextPath%>/images/save.gif",
				            handler:reject,
				            hidden:<%=session.getAttribute("btn_rejcetno_display") != null  ? false:true%>
				        },'-',
						{
				            text: '计划消缺时间调整',
				            icon:"<%=contextPath%>/images/pass.gif",
				            handler:jhsjtz,
				            hidden:<%=session.getAttribute("btn_history_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>,
							disabled:'${searchBean.con1}' == '0'? true:false
				        },'-',
				        {
				            text: '生成月度计划',
				            icon:"<%=contextPath%>/images/save.gif",
				            handler:create,
				            hidden:<%=session.getAttribute("btn_create_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>,
							disabled:'${searchBean.con1}' == '0'? true:false
				        },'-',
				        {
				            text: '返回',
				            icon:"<%=contextPath%>/images/fanhui.png",
				            handler:function(){
				            
				            	if ('${searchBean.con19}' != 'search') {
				            	//window.alert('${searchBean.con1}');
				            	if('${searchBean.con1}' != '0'){
					            	if('<%=ymbz%>'=='2'){
										back2();
				            		}else{
										back();
					            	}
				            	}else{
				            		backddqx();
				            		}
				            	} else {
     								document.frmM.action = "<%=contextPath%>/zbjlSearchList!getList.do";
     								document.frmM.submit();
				            	}
				            }
				        }
			    	]
			    });
			});
		
			function toCheck(){

			  /**	if(!Validator.Validate(frmM,2)){//保存不验证.pass验证
				  return false;
			  	}*/
  				comt();
		    }   
  // 修改进入增加第二个环节的验证 by wangtao add20120618
		function setEndCheck() {
			if ('${searchBean.con1}' == '0') {
					document.getElementById("entity.xqbzname").datatype="Require";
		    		//document.getElementById("entity.dwryname").datatype="Require";
		    		document.getElementById("entity.jhxcsj").datatype="Require";
		    		document.getElementById("entity.hbrname").datatype="Require";
		    }
		    if (document.getElementById("entity.id").value != "0") {

				if ('${searchBean.con1}' == '0') {
					document.getElementById("entity.xqbzname").datatype="Require";
		    		document.getElementById("entity.jhxcsj").datatype="Require";
		    		document.getElementById("entity.hbrname").datatype="Require";
				}else if ('${searchBean.con1}' == '1') {
					document.getElementById("entity.jhxcsj").datatype="Require";
		    		document.getElementById("entity.hbrname").datatype="Require";
		    		document.getElementById("entity.xcrname").datatype="Require";
		    		document.getElementById("entity.xcjssj").datatype="Require";
		    		document.getElementById("entity.sjxqqk").min="1";
		    		//document.getElementById("entity.ylwt").min="1";
		    		document.getElementById("entity.ylwt").datatype="Require";
				}else if ('${searchBean.con1}' == '2') {
					document.getElementById("entity.xcrname").datatype="Require";
		    		//document.getElementById("entity.xcsj").datatype="Require";
		    		document.getElementById("entity.sjxqqk").min="1";
		    		document.getElementById("entity.ylwt").datatype="Require";
		    		//document.getElementById("entity.ylwt").min="1";
				}
		    		
		    }
		    loadDate();
		}
			// 
			function loadDate() {
				Ext.Ajax.request({
					method :'POST',
					url :'sbqxjl!getXsjl.do?bdzname=' + encodeURI('${entity.bdzname}'),
					success : function(response) {
						var users = Ext.decode(response.responseText);
        				var oSelect =  document.getElementById("xszq");
						for(var i=0;i<users.length;i++) {
							var oOption = document.createElement("OPTION");
							oSelect.options.add(oOption);
							oOption.innerText = users[i]["itemname"];
							oOption.value = users[i]["itemid"];
						}
					},
					failure : function() {
						alert("链接变电运行系统失败");
					}
				});
	
			}
			
		 </script>  
	</head>
	<body onload="javascript:setEndCheck()">
		<div id ='tbar'></div>
		<br>
		<div id="Layer" style="position:absolute;display:block left:0px; top:35px; width:100%; height:94%; z-index:1000; overflow:auto;">
		
		<!-- 信息提示 -->
		<div id="result" align="center"><font color="red">${info }</font></div>
		<table width="100%" height="30">
			<tr>
				<td colspan="4" align="center">
					设备缺陷记录
				</td>
			</tr>
		</table>
		<form id="frmM2" name="frmM2" method="POST" >
		<input type="hidden" name="searchBean.con15" value="${entity.id}"/>
		<input type="hidden" name="searchBean.con1" value="${searchBean.con1}"/>
		<input type="hidden" name="searchBean.con7" value="${searchBean.con7}"/>
		</form>
		<form id="frmM" name="frmM" method="POST" action="<%=contextPath%>/entity!save.do">
		<input type="hidden" name="searchBean.con15" value="${entity.id}"/>
		<input type="hidden" name="searchBean.con1" value="${searchBean.con1}"/>
		<input type="hidden" name="searchBean.con7" value="${searchBean.con7}"/>
		<input type="hidden" name="bdzid" id="bdzid" value="${mapdefect.bdzid}"/>
		<input type="hidden" name="defectid" id="defectid" value="${mapdefect.id}"/>
			<s:hidden name="entity.id" />			
			<s:hidden name="entity.defectid" />
			<s:hidden name="entity.qxlb" />
			<s:hidden name="entity.qxnr" />
			<s:hidden name="entity.qxbh" />
			<s:hidden name="entity.bdzname" />
			<s:hidden name="entity.state" />
			<s:hidden name="entity.bdz"/>
			<s:hidden name="entity.hbr"/>
			<s:hidden name="entity.xqbz"/>
			<s:hidden name="entity.phbz"/>
			<s:hidden name="entity.jsr"/>
			<s:hidden name="entity.xcr"/>
			<s:hidden name="entity.ysr"/>
			<s:hidden name="entity.xqcy"/>
			<s:hidden name="entity.dwry"/>
			<s:hidden name="entity.ouid"/>
			<s:hidden name ="entity.dyfxr"/>
			<s:hidden name ="entity.sbid"/>
			<!--<s:hidden name ="entity.fxrq"/>-->
			<s:hidden name ="entity.sbzp" msg="缺陷照片必须上传。"/>
			<table width="100%" id="infotab">
				<tr>
				<th rowspan="6" style="text-align:center;">
				<table><tr><th style="width:14px;text-align:center;">
				<font size="3"><b>缺陷发现</b></font></th>
				</tr>
				</table></th>
					<th width="120" >
						<font color="red">*</font>&nbsp;缺陷编号：
					</th>
					<td nowrap>
					${mapdefect.serialno}
						<!-- <input type="text" maxlength="25" style="width:50%" name="entity.qxbh" value="${entity.qxbh}" msg="缺陷编号必须输入。" /> -->
					</td>
					<th width="120" nowrap>
						<font color="red">*</font>&nbsp;发现日期：
					</th>
					<td >
					${mapdefect.reporttime}
					<input type="hidden" name="entity.fxrq" value="${mapdefect.reporttime}" />
						<!--  <input type="text" onclick="WdatePicker({el:$dp.$('entity.fxrq')})" readonly="true" name="entity.fxrq" datatype="Require" value='<fmt:formatDate value="${entity.fxrq}" pattern="yyyy-MM-dd HH:mm"/>' msg="发现日期必须输入。"/>
						<img onclick="WdatePicker({el:$dp.$('entity.fxrq')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					-->
					</td>
					
				</tr>
				<tr>
					
					<th width="120" >
						<font color="red">*</font>&nbsp;变电站：
					</th>
					<td nowrap>
				<font size="4"><b>	${mapdefect.bdzname}</b></font>
						<!--  <input type="text" readonly="true" style="width:50%" datatype="Require" name="entity.bdzname" value="${entity.bdzname}" msg="变电站必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="选择变电站" onClick="javascript:getBdzjx('entity.bdz','entity.bdzname','entity.ouid')" />
					-->
					</td>
					<th width="120" nowrap>
						<font color="red">*</font>&nbsp;设备名称：
					</th>
					<td colspan="1">
						<input type="text"  style="width:80%" readonly="true" datatype="Require" name="entity.qxwz" value="${entity.qxwz}" msg="设备名称必须输入。" />
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getSB('${mapdefect.bdzid}')" />
						</td>
					
				</tr>
				<tr>
					<th width="120" nowrap>
						<font color="red">*</font>&nbsp;设备类型：
					</th>
					<td>
						<s:select list="sblxList" emptyOption="true"  name="entity.sblx" width="300" listKey="itemId" listValue="itemName" msg="设备类型必须输入。"/>
					</td>
					<th width="120" >
						<font color="red">*</font>&nbsp;设备间隔：
					</th>
					<td nowrap>
						<input type="text" style="width:50%"  name="entity.sbjg" value="${entity.sbjg}" msg="设备间隔必须输入。"/>
					</td>
					
					
				</tr>
				<tr>
					<th width="120" nowrap>
						<font color="red">*</font>&nbsp;缺陷内容：
					</th>
					<td colspan="3"><font size="2">
					${mapdefect.content}</font>
						<!--  <textarea  style="width:90%" datatype="LimitB" min="1"  max="500" rows="3" name="entity.qxnr" msg="缺陷内容必须输入并且最多输入250个汉字。">${entity.qxnr}</textarea>
					-->
					</td>
				</tr>
				<tr>
					<th width="120" nowrap>
						<font color="red">*</font>&nbsp;缺陷类别：
					</th>
					<td>
					<c:choose>
								<c:when test="${mapdefect.category == '0'}">紧急</c:when>
								<c:when test="${mapdefect.category == '1'}">重大</c:when>
							</c:choose>
				
						<!--<s:select list="qxlbList" emptyOption="true" datatype="Require" name="entity.qxlb" width="300" listKey="itemId" listValue="itemName" msg="缺陷类别必须输入。"/>
					-->
					</td>
					<th width="120" nowrap>
						&nbsp;发现人：
					</th>
					<td>
					${mapdefect.reporter}
						<!--  <input type="text"  style="width:50%"  readonly="true"  name="entity.dyfxrname" value="${entity.dyfxrname}" msg="发现人必须输入。" />
						<c:if test="${entity.id != '0'}">
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.dyfxr','entity.dyfxrname','entity.bdz')" />
					</c:if>
					-->
					</td>
					
				</tr>
			
				<tr>
				<th width="120" nowrap>
						<font color="red">*</font>缺陷照片：
					</th>
					<td>
						<c:if test="${entity.id != '0'}">
							<img style='cursor:pointer' onclick="filePopupReadonly('${entity.id}','TAB_SBQXJL-QXZP','1')" alt="打开图片列表" src="<%=contextPath%>/images/userfile.png" >
						</c:if>
						<c:if test="${entity.id == '0'}">
							&nbsp;<img style='cursor:pointer' src="<%=contextPath%>/images/redlight.gif"/><font color="red">请保存记录后上传缺陷照片</font>
						</c:if>
					</td>
					
					<th width="120" nowrap>
					</th>
					<td>
					</td>
				</tr>
				<tr>
				<th rowspan="5" style="text-align:center" >
				<table><tr><th style="width:14px;text-align:center;">
				<font size="3"><b>消缺安排</b></font></th>
				</tr>
				</table></th>
					<th width="120" nowrap>
						<font color="red">*</font>&nbsp;消缺班组：
					</th>
					<td>
						<input type="text" style="width:50%" datatype="Require" readonly="true" name="entity.xqbzname" value="${entity.xqbzname}" msg="消缺班组必须输入。" />
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getBz('entity.xqbz','entity.xqbzname','entity.ouid')" />
					</td>
					<th width="120" nowrap>
						<font color="red"></font>&nbsp;配合班组：
					</th>
					<td>
						<input type="text" style="width:50%" readonly="true" name="entity.phbzname" value="${entity.phbzname}" msg="配合班组必须输入。" />
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getBz('entity.phbz','entity.phbzname','searchBean.con7')" />
						</td>
					
				</tr>
				<tr>
					
					<th width="120" nowrap>
					<font color="red">*</font>&nbsp;计划消缺开始时间：
					</th>
					<td >
					<c:if test="${'0' == searchBean.con1 || '1' == isAdmin}">
						<input onclick="WdatePicker({el:$dp.$('entity.jhxcsj')})" type="text" readonly="true" name="entity.jhxcsj" value='<fmt:formatDate value="${entity.jhxcsj}" pattern="yyyy-MM-dd HH:mm"/>' msg="计划消缺开始时间必须输入。"/>
						<img onclick="WdatePicker({el:$dp.$('entity.jhxcsj')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
						<select name="xszq" width="300">
							<option value="巡视周期参考">巡视周期参考</option>
						</select>
					</c:if>
					<c:if test="${'0' != searchBean.con1&& '0' == isAdmin}">
						<input  type="text" readonly="true" name="entity.jhxcsj" value='<fmt:formatDate value="${entity.jhxcsj}" pattern="yyyy-MM-dd HH:mm"/>' msg="计划消缺开始时间必须输入。"/>
						<select name="xszq" width="300">
							<option value="巡视周期参考">巡视周期参考</option>
						</select>
					</c:if>
					</td>
					<th width="120" nowrap>
						<font color="red">*</font>&nbsp;计划消缺结束时间：
					</th>
					<td >
					<c:if test="${'0' == searchBean.con1 || '1' == isAdmin}">
						<input onclick="WdatePicker({el:$dp.$('entity.jhxcjssj')})" datatype="Require" type="text" readonly="true" name="entity.jhxcjssj" value='<fmt:formatDate value="${entity.jhxcjssj}" pattern="yyyy-MM-dd HH:mm"/>' msg="计划消缺结束时间必须输入。"/>
						<img onclick="WdatePicker({el:$dp.$('entity.jhxcjssj')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</c:if>
					<c:if test="${'0' != searchBean.con1&& '0' == isAdmin}">
						<input  datatype="Require" type="text" readonly="true" name="entity.jhxcjssj" value='<fmt:formatDate value="${entity.jhxcjssj}" pattern="yyyy-MM-dd HH:mm"/>' msg="计划消缺结束时间必须输入。"/>
						</c:if>
					</td>
					
				</tr>
				
				
				<tr>
				<th width="120" nowrap>
					<font color="red">*</font>&nbsp;计划消缺负责人：
					</th>
					<td>
						<input type="text" style="width:50%" maxlength="50" name="entity.hbrname" value="${entity.hbrname}" msg="计划消缺负责人必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.hbr','entity.hbrname')" />
					
					</td>
					<th width="120" nowrap>
					计划消缺成员：
					</th>
					<td>
						<input type="text" style="width:50%" maxlength="50" name="entity.jsrname" value="${entity.jsrname}" msg="消除人必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.dyfxr','entity.jsrname')" />
					
					</td>
					</tr>
					<tr>
					<th width="120" nowrap>
					计划消缺外用工人数：
					</th>
					<td>
						<input type="text" style="width:50%" maxlength="50" name="entity.wygrs" value="${entity.wygrs}" />
						
					</td>
					<th width="120" nowrap>
						到位人员
					</th>
					<td>
						<input type="text" style="width:50%" readonly="true" maxlength="50" name="entity.dwryname" value="${entity.dwryname}" msg="到位人员必须输入。" />
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.dwry','entity.dwryname','searchBean.con7')" />
						
					</td>
					<!--  <th width="120" nowrap>
						班组到位人员
					</th>
					<td>
						<input type="text" style="width:50%" readonly="true" name="entity.ysrname" value="${entity.ysrname}" msg="班组到位人员必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.ysr','entity.ysrname','searchBean.con1')" />
					</td>-->
				</tr>
					<tr>
					<th width="120" nowrap>
						未安排计划时间原因
					</th>
					<td colspan="3">
						<textarea  style="width:90%" datatype="LimitB" min="0"  max="500" rows="2" name="entity.xcyy" msg="未安排计划时间原因必须输入并且最多输入250个汉字。">${entity.xcyy}</textarea>
					</td>
		
				</tr>
				<tr>
					<th rowspan="8" style="text-align:center" >
					<table border="0"><tr><th style="width:14px;text-align:center;">
				<font size="3"><b>消缺情况</b></font></th>
				</tr>
				</table></th>
					<th width="120" nowrap>
						<font color="red"></font>&nbsp;消缺开始时间：
					</th>
					<td >
						<input onclick="WdatePicker({el:$dp.$('entity.xcsj')})" type="text" readonly="true" name="entity.xcsj" value='<fmt:formatDate value="${entity.xcsj}" pattern="yyyy-MM-dd HH:mm"/>' msg="消除开始时间必须输入。"/>
						<img onclick="WdatePicker({el:$dp.$('entity.xcsj')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
					<th width="120" nowrap>
						<font color="red">*</font>&nbsp;消缺结束时间：
					</th>
					<td >
					${mapdefect.resolvetime}
					<input type="hidden" name="entity.xcjssj" value="${mapdefect.resolvetime}" msg="消除结束时间必须等调度值班员输入。"/>
					</td>
					
				</tr>
			
				<tr>
				<th width="120" nowrap>
						<font color="red">*</font>&nbsp;消缺负责人：
					</th>
					<td>
						<input type="text" style="width:50%" maxlength="50" name="entity.xcrname" value="${entity.xcrname}" msg="消缺负责人必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.xcr','entity.xcrname')" />
						
					</td>
					<th width="120" nowrap>
						<font color="red">*</font>&nbsp;消缺工作班成员
					</th>
					<td>
						<input type="text" style="width:50%" readonly="true" name="entity.xqcyname" value="${entity.xqcyname}" msg="消缺工作班成员必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.xqcy','entity.xqcyname','searchBean.con7')" />
					</td>
					
				</tr>
			
				<tr>
					<th width="120" nowrap>
						<font color="red">*</font>&nbsp;消缺情况
					</th>
					<td colspan="3">
					${mapdefect.resolvecontent}
					<input type="hidden" name="entity.gzpj" value="${mapdefect.resolvecontent}"/>
					
					</td>
				</tr>
				<tr>
					<th width="120" nowrap>
						<font color="red">*</font>&nbsp;实际消缺情况
					</th>
					
					<td colspan="3">
						<textarea  style="width:90%" datatype="LimitB" min="0"  max="500" rows="2" name="entity.sjxqqk" msg="实际消缺情况必须输入并且最多输入250个汉字。">${entity.sjxqqk}</textarea>
					</td>
				</tr>
				<tr>
					<th width="120" nowrap>
						<font color="red">*</font>&nbsp;遗留问题
					</th>
					<td colspan="3">
						<input type="text" style="width:90%" name="entity.ylwt" value="${entity.ylwt}" maxlength="250" msg="遗留问题必须输入。"/>
					</td>
				</tr>
				<tr>
				<th width="120" nowrap>
						<font color="red"></font>缺陷处理情况照片：
					</th>
					<td>
						<c:if test="${entity.id != '0'}">
							<img style='cursor:pointer' onclick="filePopup('${entity.id}','TAB_SBQXJL-QXZP','1')" alt="打开图片列表" src="<%=contextPath%>/images/userfile.png" >
						</c:if>
						<c:if test="${entity.id == '0'}">
							&nbsp;<img style='cursor:pointer' src="<%=contextPath%>/images/redlight.gif"/><font color="red">请保存记录后上传缺陷照片</font>
						</c:if>
					</td>
					
					<th width="120" nowrap>
					</th>
					<td>
					</td>
				</tr>
				<% if ("0".equals(session.getAttribute("SESSION_ISADMIN"))) {%>
				<tr>
					<th width="120" nowrap>
						录入人员：
					</th>
					<td>
						<s:hidden name="entity.cjrid"/>
						<input type="text" style="width:50%" readonly="true" name="entity.cjr" value="${entity.cjr}" msg="录入人员必须输入。"/>
					</td>
					<th width="120" nowrap>
						录入时间：
					</th>
					<td>
						<input type="text" name="entity.cjsj" readonly="true" value='<fmt:formatDate value="${entity.cjsj}" pattern="yyyy-MM-dd HH:mm"/>' msg="录入时间必须输入。"/>
					</td>
				</tr>
				<%} else {%>
				<tr>
					<th width="120" nowrap>
						录入人员：
					</th>
					<td>
						<s:hidden name="entity.cjrid"/>
						<input type="text" style="width:50%" readonly="true" name="entity.cjr" value="${entity.cjr}" msg="录入人员必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.cjrid','entity.cjr','searchBean.con7')" />
					</td>
					<th width="120" nowrap>
						录入时间：
					</th>
					<td>
						<input type="text" onclick="WdatePicker({el:$dp.$('entity.cjsj')})" name="entity.cjsj" readonly="true" value='<fmt:formatDate value="${entity.cjsj}" pattern="yyyy-MM-dd HH:mm"/>' msg="录入时间必须输入。"/>
						<img onclick="WdatePicker({el:$dp.$('entity.cjsj')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
				</tr>
				<%}%>
				<% if ("0".equals(session.getAttribute("SESSION_ISADMIN"))) {%>
				<tr>
					<th width="120" nowrap>
						录入人员：
					</th>
					<td>
						<s:hidden name="entity.cjrid1"/>
						<input type="text" style="width:50%" readonly="true" name="entity.cjr1" value="${entity.cjr1}" msg="录入人员必须输入。"/>
					</td>
					<th width="120" nowrap>
						录入时间：
					</th>
					<td>
						<input type="text" name="entity.cjsj1" readonly="true" value='<fmt:formatDate value="${entity.cjsj1}" pattern="yyyy-MM-dd HH:mm"/>' msg="录入时间必须输入。"/>
					</td>
				</tr>
				<%} else {%>
				<tr>
					<th width="120" nowrap>
						录入人员：
					</th>
					<td>
						<s:hidden name="entity.cjrid1"/>
						<input type="text" style="width:50%" readonly="true" name="entity.cjr1" value="${entity.cjr1}" msg="录入人员必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.cjrid1','entity.cjr1','searchBean.con7')" />
					</td>
					<th width="120" nowrap>
						录入时间：
					</th>
					<td>
						<input type="text" onclick="WdatePicker({el:$dp.$('entity.cjsj1')})" name="entity.cjsj1" readonly="true" value='<fmt:formatDate value="${entity.cjsj1}" pattern="yyyy-MM-dd HH:mm"/>' msg="录入时间必须输入。"/>
						<img onclick="WdatePicker({el:$dp.$('entity.cjsj1')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
				</tr>
				<%}%>		
			</table>
		</form>
		</div>
	</body>
</html>
<script language="javascript">

	 // 保存
     function comt(){
     	//document.getElementById("entity.dwryname").value = document.getElementById("entity.dwry").options[document.getElementById("entity.dwry").selectedIndex].text;
     	document.frmM.action = "<%=contextPath%>/sbqxjl!save.do";
     	document.frmM.submit();
     }
     // 获得设备
	function getSB(bdzid) {
		var url = "/DLPLANMIS/jsp/business/sbqxjl/selectSB.jsp?bdzid="+bdzid;
		var win = openSUB(url,2,300,520,450,30);
	}

     // 返回
     function back() {
     	document.frmM2.action = "<%=contextPath%>/sbqxjlList!getList.do";
		document.frmM2.submit();
     }
     // 返回到已消除
     function back2() {
     	document.frmM2.action = "<%=contextPath%>/sbqxyxqList!getList.do";
		document.frmM2.submit();
     }	 
     
      // 返回
     function backddqx() {
     	document.frmM.action = "<%=contextPath%>/ddqxList!getList.do";
		document.frmM.submit();
     }
	 function pass(){

			  if(!Validator.Validate(frmM,2)){
				  return false;
			  	}
			  	state=0;
			  if ('${searchBean.con1}' == '0') {
				        state=1; 
                        document.frmM.action = "<%=contextPath%>/sbqxjl!history.do?state="+state;
     	                document.frmM.submit();     						
				 } else if('${searchBean.con1}' == '1') {
				Ext.Ajax.request({
				method :'POST',
				url :'sbqxjl!jhxqrqCheck.do',
				params : {
					id :document.getElementById("entity.id").value
				},
				success : function(response) {
				//alert(response.responseText);
				var obj = Ext.decode(response.responseText);
					if (obj["count"] == "1") {//alert(obj["count"]);
						Ext.MessageBox.alert('提示', '计划消缺日期超过一年须经车间同意！');
						return false;
					}else{
					 state=2; 
					 document.frmM.action = "<%=contextPath%>/sbqxjl!history.do?state="+state;
     	             document.frmM.submit();
					}
				},
				failure : function() {
					Ext.MessageBox.alert('提示', '送已消除失败！');
				}
			});
				               		
		}	
			  	
  	}
	 function passrwd(){

			  if(!Validator.Validate(frmM,2)){
				  return false;
			  	}
			  	state=0;
			  if ('${searchBean.con1}' == '0') {
				        state=1; 
						
                        document.frmM.action = "<%=contextPath%>/sbqxjl!historyrwd.do?state="+state;
     	                document.frmM.submit();
						toNewRwd('0'); 
				/**Ext.Ajax.request({
				method :'POST',
				url :'sbqxjl!history.do?state='+state,
				success : function(response) {
				alert(response.responseText);
				var obj = Ext.decode(response.responseText);
				//alert(obj["count"]);
				if (obj["sbqxid"] == "0") {alert(obj["sbqxid"]);
				Ext.MessageBox.alert('提示', '缺陷没有保存成功！');
						return false;
						}else{
					toNewRwd(obj["sbqxid"]); 
					}
				},
				failure : function() {
					Ext.MessageBox.alert('提示', '送消缺计划失败！');
				}
			});*/
                        						
				 } else if('${searchBean.con1}' == '1') {
				Ext.Ajax.request({
				method :'POST',
				url :'sbqxjl!jhxqrqCheck.do',
				params : {
					id :document.getElementById("entity.id").value
				},
				success : function(response) {
				//alert(response.responseText);
				var obj = Ext.decode(response.responseText);
					if (obj["count"] == "1") {//alert(obj["count"]);
						Ext.MessageBox.alert('提示', '计划消缺日期超过一年须经车间同意！');
						return false;
					}else{
					 state=2; 
					 document.frmM.action = "<%=contextPath%>/sbqxjl!history.do?state="+state;
     	             document.frmM.submit();
					}
				},
				failure : function() {
					Ext.MessageBox.alert('提示', '送已消除失败！');
				}
			});
				               		
		}	
			  	
  	}
		     function reject(){

			  	/**if(!Validator.Validate(frmM,2)){
				  return false;
			  	}*/
			  	state=0;
			if ('${searchBean.con1}' == '2') {
				 state=1;           	
				 } else if('${searchBean.con1}' == '1') {
				        state=0;         		
				        }	else{
				        return;
				        }	  	
  		document.frmM.action = "<%=contextPath%>/sbqxjl!reject.do?state="+state;
     	document.frmM.submit();
		    }
		     //创建计划
     function create(){
       	document.frmM.action = "<%=contextPath%>/sbqxjl!savePlan.do";
     	document.frmM.submit();
     }
    // 送消缺计划同时形成月度计划。再根据计划生成工作任务单
		function toNewRwd(sbqxid){
		//sbqxid=document.getElementById("entity.id").value;
		sbqxid=document.getElementById("defectid").value;
		 	/**Ext.Ajax.request({
				method :'POST',
				url :'gzrwd!initPermitCheck.do',
				params : {
					hiddenids :document.getElementById("hiddenids").value
				},
				success : function(response) {//alert(response.responseText);
					if (response.responseText == '1') {
						Ext.MessageBox.alert('提示', '	当日工单已经存在,请选择查看任务单！');
						return false;
					}else{
					parent.addTab("工作计划-起草任务单", "<%=contextPath%>/gzrwd!initDetail.do?searchBean.con1=0&id=" + id + "&hiddenids=" +  document.getElementById("hiddenids").value, id1);
   
					}
				},
				failure : function() {
					Ext.MessageBox.alert('提示', '查找失败！');
				}
			});*/
	
			//location.href = "<%=contextPath%>/gzrwdCreatePlan!initMonthPlanDetail.do?id=" + id;
			//location.href = "<%=contextPath%>/gzrwd!initDetail.do?searchBean.con1=0&id=" + id + "&hiddenids=" +  document.getElementById("hiddenids").value;
				// 打开窗口
		//parent.addTab("设备缺陷—>工作计划->任务单", "<%=contextPath%>/gzrwd!initDetail.do?searchBean.con1=0&id=" + id + "&hiddenids=" +  document.getElementById("hiddenids").value, id);
		var url="<%=contextPath%>/gzrwd!initRwdDetail.do?searchBean.con1=0&id=" + sbqxid;
		//alert(url);
   var win = window.open(url,"Result_window2","left=50,top=30,width=1230,height=768,status=no,toolbar=no,autoscroll=yes,location=no,menubar=no,resizable=yes",true);
		
				}
				// 计划时间调整
	 function jhsjtz () {
	 
	 	if (document.getElementById("entity.id").value == ""||document.getElementById("entity.id").value == 0) {
	 		alert("请先保存设备缺陷记录");
	 		return;
	 	}
	 	var win = window.open("<%=contextPath%>/sbqxjl!initJhsjtz.do?kgFlag=1&id=" + document.getElementById("entity.id").value,"Result_window","left=250,top=30,width=600,height=300,status=no,toolbar=no,autoscroll=yes,location=no,menubar=no,resizable=yes",true);
	 //	var url = "<%=contextPath%>/gzptjjl!initDrkgzj.do?kgFlag=1&id=" + document.getElementById("entity.id").value;
     //   var win = openSUB(url,2,400,200,450,30);
	 } 
</script>